FROM node:22 AS builder

WORKDIR /app

COPY package.json .
COPY yarn.lock yarn.lock
COPY tsconfig.json tsconfig.json
RUN yarn install --registry https://registry.npmmirror.com/

COPY ./src ./src

RUN yarn build

FROM node:22

WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
EXPOSE 3000
CMD ["node", "dist/index"]

